<template>
  <div class="purchase-order table-theme">
    <head-title title="订单--采购订单详情"></head-title>
    <el-card>
      <el-descriptions title="采购订单详情" :column="4">
        <el-descriptions-item label="订单编号">{{ order_info.order_sn }}</el-descriptions-item>
        <el-descriptions-item label="订单ID">{{ order_info.order_id }}</el-descriptions-item>
        <el-descriptions-item label="下单时间">{{ order_info.add_time }}</el-descriptions-item>
        <el-descriptions-item label="订单金额">{{ order_info.order_amount }}元</el-descriptions-item>
        <el-descriptions-item label="订单审核状态">{{ order_info.examine_status_name }}</el-descriptions-item>
        <el-descriptions-item label="订单状态">{{ order_info.status_name }}</el-descriptions-item>
        <template v-if="admin_id!=3">
          <el-descriptions-item label="下单员">{{ order_info.create_by }}</el-descriptions-item>
          <el-descriptions-item label="审核员">{{ order_info.examine_user }}</el-descriptions-item>
        </template>
      </el-descriptions>
      <el-descriptions :column="1">
        <el-descriptions-item label="采购备注">{{ order_info.follow_brief }}</el-descriptions-item>
        <el-descriptions-item label="审核说明">{{ order_info.examine_brief }}</el-descriptions-item>
      </el-descriptions>
      <el-descriptions title="采购订单信息" style="margin-top: 20px;"></el-descriptions>
      <el-table :data="list" stripe>
        <el-table-column label="工厂ID" align="center" prop="factory_id" width="80" v-if="admin_id!=3"></el-table-column>
        <el-table-column label="工厂名称" align="center" prop="factory_name" v-if="admin_id!=3"></el-table-column>
        <el-table-column label="商品ID" align="center" prop="goods_id" width="80"></el-table-column>
        <el-table-column label="商品编号" align="center" prop="goods_sn"></el-table-column>
        <el-table-column label="商品sku编号" align="center" prop="sku_sn"></el-table-column>
        <el-table-column label="工厂货号" align="center" prop="lining_sn"></el-table-column>
        <el-table-column label="数量" align="center" prop="purchase_num"></el-table-column>
        <el-table-column label="工厂价" align="center" prop="factory_price"></el-table-column>
        <el-table-column label="图片" align="center" width="60">
          <template slot-scope="scope">
            <el-image :src="scope.row.img" style="width: 50px; height: 50px"></el-image>
          </template>
        </el-table-column>
        <el-table-column label="颜色" align="center" prop="color"></el-table-column>
        <el-table-column label="材质" align="center" prop="lining"></el-table-column>
        <el-table-column label="尺寸" align="center" prop="size"></el-table-column>
        <el-table-column label="已入库数" align="center" prop="warehouse_num"></el-table-column>
      </el-table>
      <template v-if="stock_list.length">
        <el-descriptions title="订单入库明细" style="margin-top: 20px;"></el-descriptions>
        <el-table :data="stock_list" stripe>
          <el-table-column label="商品ID" align="center" prop="goods_id" width="80"></el-table-column>
          <el-table-column label="商品编号" align="center" prop="goods_sn"></el-table-column>
          <el-table-column label="商品sku编号" align="center"  prop="sku_sn"></el-table-column>
          <el-table-column label="工厂货号" align="center" prop="lining_sn"></el-table-column>
          <el-table-column label="工厂价" align="center" prop="factory_price"></el-table-column>
          <el-table-column label="图片" align="center" width="60">
            <template slot-scope="scope">
              <el-image :src="scope.row.img" style="width: 50px; height: 50px"></el-image>
            </template>
          </el-table-column>
          <el-table-column label="颜色" align="center" prop="color"></el-table-column>
          <el-table-column label="材质" align="center" prop="lining"></el-table-column>
          <el-table-column label="尺寸" align="center" prop="size"></el-table-column>
          <el-table-column label="入库数" align="center" prop="num"></el-table-column>
          <el-table-column label="入库时间" align="center" prop="add_time" width="165"></el-table-column>
        </el-table>
      </template>
    </el-card>
  </div>
</template>

<script>
  export default {
    data(){
      return {
        admin_id: localStorage.getItem('admin_id'),
        order_info: {},
        list: [],
        stock_list: []
      }
    },
    mounted(){
      this.init()
    },
    methods: {
      init(){
        this.$http(this.$ApiList.PurchaseOrderInfo,{order_id: this.$route.query.order_id}).then(res => {
          this.order_info = res.datas.order_info
          this.list = [res.datas.order_info]
          this.stock_list = res.datas.stock_list
        })
      }
    }
  }
</script>

<style lang="scss" scoped></style>